# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-w3lib
_pkgname=w3lib
pkgver=2.2.1
# Upstream doesn't always tag releases
_gittag=a50090f18c081e3eede7a070585650f835440565
pkgrel=0
pkgdesc="A library of web-related functions"
url="https://github.com/scrapy/w3lib"
arch="noarch"
license="BSD-3-Clause"
depends="python3"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$_gittag.tar.gz::https://github.com/scrapy/w3lib/archive/$_gittag.tar.gz"
builddir="$srcdir/$_pkgname-$_gittag"

replaces="py-w3lib" # Backwards compatibility
provides="py-w3lib=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$builddir"/.dist/*.whl
	.testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
d777475d1e10806ee2397023262f2ec3b6dff566c48f85e5c18e68fe2c9b7dfc995afd54c89de6b61af67343f4b5a0c533191c716decbb7a9bbee05ed4bd0653  py3-w3lib-a50090f18c081e3eede7a070585650f835440565.tar.gz
"
